<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta http-equiv="X-UA-Compatible" content="IE=edge" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>Document</title>
    <script src="./node_modules/vue/dist/vue.js"></script>
  </head>

  <body>
    <div id="app">
      <input type="text" v-focus.a.b="1+1" />
    </div>
    <script>
      // 自定义指令

      // v-focus
      Vue.directive("focus", {
        // 组件的生命周期是一样的
        bind(el, binging) {
          console.log(el);
          console.log(binging);
          el.focus();
        },
        inserted(el) {
          el.focus();
        },
      });

      const app = new Vue({
        el: "#app",
        data: {
          msg: "hello ",
        },
      });
    </script>
  </body>
</html>
